ListView colors

Otázka od: ViragI@logica.com

16. 9. 2002 15:49

Zdravim.

Uz nekolikrat tu probehl problem, jak barevne odlisit radky DBGridu podle
hodnoty nejakeho pole. Jak ten samy problem vyresit u TListView? Dekuji.

ivan virag

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Odpovedá: ViragI@logica.com

16. 9. 2002 15:24

Omlouvam se. Zapomel jsem uvest jde o D6 SP2, Windows2000 SP3,

Ivan Virag

-----Original Message-----
From: ViragI@logica.com [mailto:ViragI@logica.com]

Zdravim.

Uz nekolikrat tu probehl problem, jak barevne odlisit radky DBGridu podle
hodnoty nejakeho pole. Jak ten samy problem vyresit u TListView? Dekuji.

ivan virag


This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Odpovedá: Petr Vones

16. 9. 2002 16:39

From: <ViragI@logica.com>
> Uz nekolikrat tu probehl problem, jak barevne odlisit radky DBGridu podle
> hodnoty nejakeho pole. Jak ten samy problem vyresit u TListView? Dekuji.

Pomoci udalosti OnCustomDrawItem

procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
  if not (cdsFocused in State) then
  begin
    if Item.Index mod 2 = 0 then
      Sender.Canvas.Brush.Color := clBlue
    else
      Sender.Canvas.Brush.Color := clYellow;
  end;
end;

Petr Vones